package cn.lhjl.day05.practice;

import java.text.ParseException;
import java.util.Random;

public class ProduceRandomCode {
    public static void main(String[] args) throws ParseException {
        String str=produceRonCode();
        System.out.println(str);
    }
    public static String produceRonCode(){
        String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
        String code = "";
        Random random = new Random();

        for (int i = 0; i < 8; i++) {
            int num = random.nextInt(62);
            code += str.substring(num,num+1);
        }
        return code;
    }
}